from pyecharts.charts import Line
from pyecharts.options import InitOpts,TitleOpts,LegendOpts,ToolboxOpts,VisualMapOpts,AxisOpts

line1=Line(init_opts=InitOpts(width="1300px",height="600px",page_title="各地区水质污染评价"))
line1.add_xaxis(
    ["四川攀枝花","重庆朱沱","湖北宜昌南津关","湖南岳阳城陵矶","江西九江河西水厂",
     "安徽安庆皖河口","江苏南京林山","四川乐山岷江大桥","四川宜宾凉姜沟","四川泸州沱江二桥",
     "湖北丹江口胡家岭","湖南长沙新港","湖南岳阳岳阳楼","湖北武汉宗关","江西南昌滁槎",
     "江西九江蛤蟆石","江苏扬州三江营"])
line1.add_yaxis("污染状况",[1.2515,0.6720,0.5803,0.6957,-0.3910,0.2064,0.5239,0.1960,0.9281,-0.5569,0.1885,-1.2465,-0.1618,-0.3590,-2.6519,-0.4081,-0.2494])

line1.set_global_opts(
    title_opts=TitleOpts("各地区水质污染", pos_left="end", pos_top="1%"),
    legend_opts=LegendOpts(is_show=True),
    toolbox_opts=ToolboxOpts(is_show=True),
    visualmap_opts=VisualMapOpts(is_show=True),
    xaxis_opts=AxisOpts(type_='category',name='地区',name_location='end',name_gap=20,axislabel_opts={"interval":"0","rotate":30})
)

line1.render()